package ygg.encoding.swf.tag.codec
{
	import j.sus2maj7.encoding.*;
	import j.sus2maj7.context.*;
	
	import ygg.encoding.swf.tag.*;
	import ygg.encoding.swf.tag.object.*;
	
	public class DefineSceneAndFrameLabelDataCodec extends TagCodec
	{
		public function DefineSceneAndFrameLabelDataCodec()
		{
			super();
		}
		
		override public function decode(binary:IBinary, context:IContext=null):*
		{
			var retVal:DefineSceneAndFrameLabelData = new DefineSceneAndFrameLabelData();
			var b:TagBinary = binary as TagBinary;
			b.position = 0;
			b.syncBits();
			
			var count:uint = b.readEncU32();
			trace('scenecount=', count);
			
			retVal.scenes = new Array(count);
			var i:int;
			var j:uint;
			var k:String;
			
			trace(count);
			for (i = 0; i < count; i++)
			{
				j = b.readEncU32();
				k = b.readString();
				
				trace(j, k);
				retVal.scenes.push( {offset:j, name:k } );
			}
			
			
			count = b.readEncU32();
			trace(count);
			retVal.frameLabels = new Array(count);
			for (i = 0; i < count; i++)
			{
				j = b.readEncU32();
				k = b.readString();
				trace(j, k);
				retVal.frameLabels.push( {num:j, frameLabel:k } );
			}
			
			return retVal;
		}
		
		override public function encode(o:*, context:IContext=null):IBinary
		{
			var b:TagBinary = new TagBinary();
			var obj:DefineSceneAndFrameLabelData = o as DefineSceneAndFrameLabelData;
			
			
			
			return b;
		}
	}
}